package zuo.from0516.real;

public class Code01_day0910 {
    //删除有序数组的重复元素
    public static void main(String[] args) {
        int[] nums = new int[]{1,2,3,3,4,4,5};
        System.out.println(removeValue(nums));

    }
    public static int removeValue(int[] nums){
        int i = 0;
        for (int j = 1; j < nums.length; j++) {
            if (nums[i] != nums[j]){
                nums[i+1] = nums[j];
                i++;
            }
        }
        return i+1;
    }

}
